import json
from models import BaseModels
from sqlalchemy import Column, BigInteger, DateTime, String, ForeignKey, Text, Integer, Float


class StationLog(BaseModels):
    __tablename__ = 'stationlog'
    id = Column(BigInteger, autoincrement=True, primary_key=True, unique=True, nullable=False)
    time = Column(DateTime, index=True, comment="记录创建时间")
    sequence = Column(String(64), index=True, comment="产品序列SN")
    ft_id = Column(Integer, ForeignKey("facility.id", ondelete='CASCADE'), index=True, comment="设备ID")
    ft_name = Column(String(64), index=True, comment="设备名称")
    title = Column(String(64), index=True, comment="PLC信号触发触发类型")
    address = Column(String(64), index=True, comment="PLC触发地址")
    value = Column(String(64), index=True, comment="PLC触发值")
    feedback = Column(String(64), index=True, comment="MES处理结果")
    message = Column(String(64), nullable=True, comment="备注")
    datainfo = Column(Text, comment="总体信息")
    dataios = Column(Text, comment="采集PLC信息汇总")



